<?php
/**
 * @author          faithsmine@gmail.com 
 * @copyright       www
 * @version         1.0
 * @name            post.html.php
 * @todo            发布项目后台处理
 * @final           2009-12-11
 */
!defined("IN_YCTOOL") && exit();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tranitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css">
<!--
/*公用部分*/
Body{
BORDER-TOP-WIDTH: 20px; PADDING-RIGHT: 20px; PADDING-LEFT: 30px;  BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; text-align:left; font-size:12px;
}
HTML {
BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px;BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px;
}
input, select, textarea{ border:1px solid #999;
}
img{border:0;}
SELECT {FONT-SIZE:12px; VERTICAL-ALIGN: middle; width:253px;}
INPUT {
FONT-SIZE:12px; 
VERTICAL-ALIGN: middle;
padding:1px;
COLOR: #333;
}
.checkbox{BORDER: #fff 0px solid;}
.redbuttom{padding:3px 2px 1px 2px; TEXT-ALIGN: center;
 BORDER-RIGHT: #6a6a6a 1px solid; BORDER-TOP: #fff 1px solid;BACKGROUND: #36BEFA; COLOR: #fff; BORDER-BOTTOM: #6a6a6a 1px solid; cursor:pointer;}
TEXTAREA {FONT-SIZE: 12px; VERTICAL-ALIGN: middle;}
div,form,img,ul,ol,li,dl,dt,dd {margin: 0px; padding: 0px; border: 0px;}
h1,h2,h3,h4,h5,h6 { margin:0px; padding:0px;}
table,td,tr,th{font-size:12px;}
a:link {color: #5a5a5a;text-decoration: underline;}
a:visited {color: #5a5a5a;text-decoration: underline;}
a:hover {color: #5c0e8f;text-decoration:none;} 
a:active {color: #5a5a5a;text-decoration: none;}
.area_box{ margin:10px auto; padding:0px; width:100%; text-align:left; font-size:12px; line-height:30px;}
.area_box h4{ font-size:14px;}
li {float:left; width:210px;}
.red {color: #FF0000}
img{ border:1px #C4C4C4 solid;}
.messagebox_1_form{
 width:600px;
 height:150px;
 }-->
</style>
<script language="javascript" src="../javascript/del_confirm.js"></script>
<script type="text/javascript" src="../javascript/jquery.js"></script>
<script type="text/javascript" src="../javascript/selected_form.js"></script>
<script type="text/javascript" src="../javascript/common.js"></script>
<script type="text/javascript" src="../js/prototype.js"></script>
<script type="text/javascript">
/*显示图片*/
function showpic(file,img)
{ 
 var dFile = document.getElementById(file.id);
 var dImg = document.getElementById(img);
 //var dInfo = document.getElementById('img');
   if(!dFile.value.match(/.jpg|.gif|.png|.bmp/i))
   {
      alert('图片类型必须是: .jpg, .gif, .bmp or .png !');
      return;
   }
    if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){   
       dImg.src = dFile.files[0].getAsDataURL();
     }  else
   {
     /*这步骤是用来在ie6,ie7中显示图片的*/  
 var newPreview = document.getElementById('pic1');
 newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = dFile.value;
    dImg.style.display='none';
     newPreview.style.width = "105px";
     newPreview.style.height = "105px";
   }
  
}

function ajaxChgCls(chgcls)
{
    if (chgcls != '')
    {
        alert(chgcls);
    }
}
function chgPcls(cid)
{    alert($('#id_pclass').val());
    if ($('#id_pclass').val() != '')
    {
        ajaxpost(ajaxChgCls, "ajax=chgcls&pclsid=" + $('#id_pclass').val());
    }
    
}

 function test() {

            // 创建Ajax.Request对象，发起一个Ajax请求

            var myAjax = new Ajax.Request(

                'post.action.php', // 请求的URL

                {

                    method: 'POST', // 使用GET方式发送HTTP请求

                    onComplete: chgSelect // 指定请求成功完成时需要执行的方法

                }

            );

        }

       

        function chgSelect(response) {

            $('divResult').innerHTML = response.responseText;

        }

 
</script>

<title>控制后台</title>
</head>
<base target="_self" >
<body>
<br />
<?php
foreach ($typearray as $key => $value)
{
	if($type == $key) {$typename = $value;}
}

?>

<a style="margin-left:60px;" href="admin.php?action=list&operation=<?php echo $operation;?>&type=<?php echo $type;?>">
<?php echo $typename; ?>列表</a>
<?php 
if ($rs)
{
?>
<a href="admin.php?action=post&operation=<?php echo $operation;?>&type=<?php echo $type;?>">发布<?php echo $typename; ?></a>
<?php
}
?>
<br />
<hr style="width:100%;height:1px;color:#EFF669;">
<br /><br />
<form name"form1" method="post" action="" enctype="multipart/form-data">
<input name="actionPost" type="hidden" value="add">
<input name="id" type="hidden" value="<?php echo $rs[$idkey];?>">
<?php 
if ($operation == 'news')
{
    ?>
<?php echo $typename;?>标题： <input name="ntitle" type="text" size="82" value="<?php echo $rs['ntitle'];?>">
<br /><br /> 
<?php echo $typename;?>内容： <textarea name="ncontent" cols="80" rows="18"><?php echo $rs['ntitle'];?></textarea>

<br /><br /> 
<?php   
}
else if ($operation == 'products')
{
?>

&nbsp;&nbsp;<?php echo $typename;?>名称： <input name="pname" type="text" size="40" value="<?php echo $rs['pname'];?>">
<br /><br /> 
&nbsp;&nbsp;<?php echo $typename;?>类别： <SELECT name="pclass" id="id_pclass" onchange="chgPcls(this.value)">
<option value="">--请选择--</option>
<?php
    foreach ($pcls_arrs as $key => $val)
    {
        echo "<option value='" . $val['clsid'] . "'>" . $val['clsname'] . "</option>";
    }                                 
?></SELECT>
<script language="javascript">
selectisvalue('#id_pclass','<?php echo $rs['pclass'];?>')
</script>
<br /><br />
&nbsp;&nbsp;<?php echo $typename;?>品牌： <SELECT name="pbrand" id="id_pbrand">
<?php
    foreach ($plabel_arrs as $val)
    {
        echo "<option value='" . $val['clsid'] . "'>" . $val['clsname'] . "</option>";
    }                                 
?></SELECT>
<script language="javascript">
selectisvalue('#id_pbrand','<?php echo $rs['pbrand'];?>')
</script>
<br /><br />

&nbsp;&nbsp;<?php echo $typename;?>规格： <input name="pstandard" type="text" size="65" value="<?php echo $rs['pstandard'];?>">
<br /><br />
<?php echo $typename;?>市场价： <input name="pprice" type="text" size="12" value="<?php echo $rs['pprice'];?>">元
<br /><br />
<?php echo $typename;?>优惠价： <input name="poffers" type="text" size="12" value="<?php echo $rs['poffers'];?>">元
<br /><br />
&nbsp;&nbsp;<?php echo $typename;?>数量： <input name="pcount" type="text" value="<?php echo $rs['pcount'];?>" size="12" >件(个)
<br /><br />
<?php echo $typename;?>形象图： <input id="id_pimage" name="pimage" type="file" size="30" onChange="showpic(this,'img1');"/>
<input name="existimg" type="hidden" value="<?php echo $rs['pimage'];?>"/>
<br /><br />
<div style="margin-left:78px;width:397px;height:240px;border:1px solid #9c9a9c;">
<div id="pic1" width="392px" border='0' height="240px"></div><img id="img1" src="<?php echo $rs['pimage'];?>" width="392px" border='0' height="240px"/>
</div>
<br />
&nbsp;&nbsp;<?php echo $typename;?>描述： <textarea name="pdescrip" cols="62" rows="10"><?php echo $rs['pdescrip'];?></textarea>
<br /><br />
&nbsp;&nbsp;<?php echo $typename;?>设置： <label class="lableradio" for="id_sale">
              <input id="id_sale" type="radio" value="1" class="checkbox" name="sale"  <?php if($rs['sale'] == 1) echo "checked";?> />
              <span>上架</span></label>
                <label class="lableradio" for="id_unsale">
                <input id="id_unsale" type="radio" value="2" class="checkbox" name="sale" <?php if($rs['sale'] == 2) echo "checked";?> />
                  <span>下架</span></label>
<br/><br/>
<?php    
}
else if ($operation == 'pcls')
{
?>

&nbsp;&nbsp;<?php echo $typename;?>名称： <input name="clsname" type="text" size="40" value="<?php echo $rs['clsname'];?>">
<br /><br /> 
&nbsp;&nbsp;<?php echo $typename;?>类别： <SELECT name="paid" id="id_paid">
<option value=''>--请选择--</option>
<option value='0'>新类别</option>
<?php
    foreach ($pcls_arrs as $key => $val)
    {
        echo "<option value='". $val['clsid'] . "'>" . $val['clsname']. "</option>";
    }                                 
?></SELECT>
<script language="javascript">
selectisvalue('#id_paid','<?php echo $rs['paid'];?>')
</script>
 
<?php    
}
else if ($operation == 'plabel')
{
?>

&nbsp;&nbsp;<?php echo $typename;?>名称： <input name="clsname" type="text" size="40" value="<?php echo $rs['clsname'];?>">
<br /><br /> 
&nbsp;&nbsp;<?php echo $typename;?>类别： <SELECT name="paid" id="id_paid">
<option value=''>--请选择--</option>
<?php
    foreach ($plabel_arrs as $key => $val)
    {
        echo "<option value='". $val['clsid'] . "'>" . $val['clsname']. "</option>";
    }                                 
?></SELECT>
<script language="javascript">
selectisvalue('#id_paid','<?php echo $rs['paid'];?>')
</script>
 
<?php    
}
?> 
<br /><br />
 
 ---------------------------------------------<button type="submit" name="Submit" class="redbuttom" >提交</button>---------------------------------------------
</form>
<hr style="width:100%;height:1px;color:#EFF669;">
</body>
</html>
